package link.jfire.socket.socketserver.handler.impl;

import javax.annotation.Resource;
import link.jfire.baseutil.collection.ByteBufferPool;
import link.jfire.baseutil.simplelog.ConsoleLogFactory;
import link.jfire.baseutil.simplelog.Logger;
import link.jfire.socket.socketserver.bus.BusinessCommand;
import link.jfire.socket.socketserver.handler.EntryHandler;
import link.jfire.socket.socketserver.storage.Entry;

@Resource
public class ClearBufferCacheHandler implements EntryHandler
{
    private Logger logger = ConsoleLogFactory.getLogger();
    
    @Override
    public byte interestedDataPacketType()
    {
        return BusinessCommand.CLEAR_BUFFER;
    }
    
    @Override
    public void handler(Entry entry)
    {
        logger.debug("清除内存缓存");
        ByteBufferPool.clearBufferCache();
        entry.getServerChannelInfo().close();
    }
    
}
